import { AttributeKeys, BattleRoleState } from "../data/CFCommon";

export default class BattleRole {

    isOwner: boolean = false;
    roleId: number = 0;
    heroId: number = 0;
    initAttr: Map<number, number> = null;
    stateList = {}
    buffList = []
    shieldList = {}
    signetList = {}

    constructor(obj, isOwner, roleId) {
        this.isOwner = isOwner;
        this.roleId = roleId;

        this.stateList = {}
        this.buffList = []
        this.shieldList = {}//护盾列表
        this.signetList = {}//印记

        for (let k in AttributeKeys) {
            this.initAttr[k] = obj[k] ? Math.floor(obj[k]) : 0;
        }
    }

    checkAction() {
        let can = !this.stateList[BattleRoleState.Banishment]
            && !this.stateList[BattleRoleState.Frozen]
            && !this.stateList[BattleRoleState.Vertigo] //如果有眩晕效果则该回合不行动
        return can
    }
}